# gnumake

CC	= dmc
LIBR	= lib
CFLAGS	= -I. -Iinclude -Icompat -IWIN32-Code -DWIN32=1 -D_WIN32=1 -D_STDCALL_SUPPORTED=1 -D__SC__=1 -DHAVE_CONFIG_H=1 

CORE_OBJS=event.obj buffer.obj bufferevent.obj bufferevent_sock.obj \
	bufferevent_pair.obj listener.obj evmap.obj log.obj evutil.obj \
	strlcpy.obj signal.obj bufferevent_filter.obj evthread.obj \
	bufferevent_ratelim.obj evutil_rand.obj miniheap-internal.obj
	
WIN_OBJS=win32select.obj evthread_win32.obj buffer_iocp.obj \
	event_iocp.obj bufferevent_async.obj dmc_win32.obj
	
EXTRA_OBJS=event_tagging.obj http.obj evdns.obj evrpc.obj

all: ../libeventd/test/libevent_core.lib ../libeventd/test/libevent_extras.lib ../libeventd/test/libevent.lib

%.obj: %.c 
	$(CC) $(CFLAGS) $^ -c -o$@

../libeventd/test/libevent_core.lib: $(CORE_OBJS) $(WIN_OBJS)
	$(LIBR) -c $@ $^

../libeventd/test/libevent_extras.lib: $(EXTRA_OBJS)
	$(LIBR) -c $@ $^

../libeventd/test/libevent.lib: $(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS)
	$(LIBR) -c $@ $^

test.obj: ../test.c
	dmc $(CFLAGS) $^ -c -o$@

test: test.obj $(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS)
	link $^,2test.exe,,advapi32+ws2_32+user32+shell32+kernel32/noi/delexe;

clean:
	rm *.map *.obj *.lib *.bak
